<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<link type="text/css" href="./assets/styles/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('.text_date').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
			$('#btn-export').click(function(){	
				if(confirm('ダウンロードしますか？')){
					document.form1.csv.value="download";
					document.form1.submit();
				}
			});
			$('#btn-reset').click(function(){	
				location.href = document.form1.action;
			});
			
			$('#btn_search').click(function(){	
				document.form1.csv.value="";
				document.form1.submit();
			});
			
			$('.sort').change(function(){
				if (this.value == 2) {
					$('#tr_op3')['hide']();
					$('#tr_op2')['show']();
				}else if (this.value == 3) {
					$('#tr_op2')['hide']();
					$('#tr_op3')['show']();
				}else {
					$('#tr_op2')['hide']();
					$('#tr_op3')['hide']();
				}
			});
			
		});
		function toPage(thepage) {
			document.form1.page.value =  thepage;
			document.form1.csv.value="";
			document.form1.submit();
		}
		</script>
		<link rel="stylesheet" type="text/css" href="./assets/styles/tablesorter.css" />
		<script type="text/javascript" src="./assets/scripts/tablesorter.js"></script>
	</head>
	<body id="">
{{$menu}}
{{$logout}}
		<div id="container"><div class="wrapper">
			<h2>店舗マスター管理</h2>
			<ul class="submenu clearfix">
				<li>店舗情報一覧</li>
				<li><a href="mshop_form.php">店舗情報登録</a></li>
				<li><a href="mshop_import.php">CSV更新</a></li>
			</ul>
			<h3>店舗情報一覧</h3>
			<form name="form1" id="form1" method="get" action="mshop_index.php" >
				<input type="hidden" name="page" />
				<table class="formTable">
					<tbody>
						<tr>
							<th>店舗コード</th>
							<td>
								<input type="text" name="shop_cd" value="{{ $forms.shop_cd }}" class="text" />
							</td>
							<th>店舗名</th>
							<td>
								<input type="text" name="shop_name" value="{{ $forms.shop_name }}" class="text" />
							</td>
						</tr><tr>
							<th>ブロック</th>
							<td>
{{ html_options id='block_cd' name='block_cd' options=$block selected=$forms.block_cd }}
							</td>
							<th>都道府県</th>
							<td>
{{ html_options id='local_cd' name='local_cd'  options=$local selected=$forms.local_cd }}
							</td>
						</tr> <tr>
							<th>AJA絞込</th>
							<td>
{{ html_radios  name='sort' class="sort" options=$sorts selected=$forms.sort separator='&nbsp;' }}
							</td>
							<th>AJA名</th>
							<td >
<span id="tr_op2"  style="display:{{if ($forms.sort == 2) }}block{{ else }}none{{ /if}};">
{{ html_options name='area_aja' options=$areauser selected=$forms.area_aja }}{{ $err.area_aja }}</span> 
<span id="tr_op3"  style="display:{{if ($forms.sort == 3) }}block{{ else }}none{{ /if}};">
{{ html_options id='zone_aja' name='zone_aja'  options=$zoneuser selected=$forms.zone_aja }}{{ $err.zone_aja }}</span> 
							</td>
						</tr>
						<tr>
							<th>更新日</th>
							<td colspan=3>
								<input type="text" name="upd_f" class="text_date" value="{{ $forms.upd_f }}" /> ～ 
								<input type="text" name="upd_t" class="text_date" value="{{ $forms.upd_t }}" />
							</td>
						</tr>
					</tbody>
				</table>
				<p class="button" style="text-align:right">
					<button type="button" id="btn-reset"><span>クリア</span></button>
					<button type="button" id="btn_search" class="submit"><span>絞込検索</span></button>
				</p>
				<input type="hidden" name="search" value="1" />
				<input type="hidden" name="csv" />
			</form>
{{ if is_numeric($page.cnt) }}
{{ if $page.cnt > 0 }}
			<p class="message">{{ $page.cnt }}件の情報が見つかりました。</p>
			<p align="left">{{$pageing}}</p>
			<table id="search_result" class="sortable">
				<thead>
					<tr>
						<th><h3>店舗コード</h3></th>
						<th><h3>店名</h3></th>
						<th><h3>ブロック</h3></th>
						<th><h3>都道府県</h3></th>
						<th><h3>電話</h3></th>
						<th><h3>ゾーンAJA</h3></th>
						<th><h3>エリアAJA</h3></th>
						<th><h3>更新日時</h3></th>
						<th><h3>更新者</h3></th>
						<th><h3>操作</h3></th>
					</tr>
				</thead>
				<tbody>
{{ foreach from=$data key=k item=v name="member" }}
					<tr class="{{cycle values=odd,mod name='member'}}">
						<td>{{ $v.shop_cd }}</td>
						<td>{{ $v.shop_name }}</td>
						<td>{{ $v.block_name }}</td>
						<td>{{ $v.local_name }}</td>
						<td>{{ $v.tel }}</td>
						<td>{{ $v.zone_name }}</td>
						<td>{{ $v.area_name }}</td>
						<td class="center">{{ $v.u_time|date_format:"%Y/%m/%d %H:%M" }}</td>
						<td >{{ $v.m_user_name }}</td>
						<td class="center"><a href="mshop_form.php?id={{ $v.id }}">[更新]</a></td>
					</tr>
{{ /foreach }}
				</tbody>
			</table>
			<p align="right">{{$pageing}}</p>

				<p class="button">
					<button type="button" id="btn-export"  ><span>CSVダウンロード</span></button>
				</p>
{{ else }}
<p class="message">条件にマッチする情報は見つかりませんでした。</p>
{{ /if }}
{{ else }}
	<p class="message">ここに検索結果が表示されます。</p>
{{ /if }}
		</div></div>
		{{ $footer }}
	</body>
</html>